<?php

namespace common\models\book;

use Yii;

/**
 * This is the model class for table "{{%company}}".
 *
 * @property int $id
 * @property string $name 单位名称
 * @property string $abbr 简称缩写
 * @property string $mark 备注
 * @property string|null $model 创建来源模型
 * @property int $model_id 创建来源模型ID
 * @property int $status 状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 * @property int $deleted_at 删除时间
 */
class Company extends \common\db\ActiveRecord {

    use \common\traits\Constants;

    /**
     * 状态
     */
    const STATUS_ACTIVE = 10;
    const STATUS_DEFAULT = 0;
    const PLATFORM_DEFAULT_ID = 1;

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%company}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['name'], 'required'],
            [['model_id', 'status', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['name', 'abbr', 'model'], 'string', 'max' => 50],
            [['mark'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'name' => '单位名称',
            'abbr' => '简称缩写',
            'mark' => '备注',
            'model' => '创建来源模型',
            'model_id' => '创建来源模型ID',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
            'deleted_at' => '删除时间',
        ];
    }

}
